﻿using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;

namespace FastAccess
{
	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			
			if (Utils.ExistsFastAccess())
				Application.ExitThread();
			else
			{
				try
				{
					if (!File.Exists("FastAccess.html"))
						File.Create("FastAccess.html");

                    Utils.LoadConfig();
                    if ((!Utils.IsOnStartup()) && (Utils.AppConfig.RunOnStatUp))
                        Utils.RunOnStartUp(true);

                    FrmFast f = new FrmFast();
                    f.Visible = false;
                    Application.Run();
                }
                finally
                {
                    Utils.SaveConfig();
                }
            }
        }
    }
}
